/**
 * @Author wywinstonwy
 * @Date 2022/1/2 10:52 下午
 * @Description:
 */
import 'package:demo202112/utils/common_appbar.dart';
import "package:flutter/material.dart";
enum ConferenceItem { AddMember, LockConference, ModifyLayout, TurnoffAl }

class WyButtoms extends StatefulWidget {
  const WyButtoms({Key? key}) : super(key: key);

  @override
  _WyButtomsState createState() => _WyButtomsState();
}

class _WyButtomsState extends State<WyButtoms> {


  @override
  Widget build(BuildContext context) {
    var selectItemValue = '北京';
    Object? _dropValue = '语文';
    final List<DropdownMenuItem> items = [];
    final DropdownMenuItem item1 = DropdownMenuItem(
      child: Text('北京'), value: '北京',);
    final DropdownMenuItem item2 = DropdownMenuItem(
      child: Text('上海'), value: '上海',);
    final DropdownMenuItem item3 = DropdownMenuItem(
      child: Text('广州'), value: '广州',);
    final DropdownMenuItem item4 = DropdownMenuItem(
      child: Text('深圳'), value: '深圳',);
    items.add(item1);
    items.add(item2);
    items.add(item3);
    items.add(item4);

    return Scaffold(
      appBar: getAppBar('内置各种buttons'),
      body: Container(
        padding: EdgeInsets.all(30),
        child: ListView(
            children: [
              _buildButton(
                  ElevatedButton(
                  onPressed: _ontap,
                  child: Text('ElevatedButton'),
                    


              )
              ),
              _buildButton(TextButton(onPressed: _ontap, child: Text('TextButton'))),
              const BackButton(),
              const CloseButton(),
              DropdownButton(
                value: _dropValue,
                items: [
                  DropdownMenuItem(child: Text('语文'),value: '语文',),
                  DropdownMenuItem(child: Text('数学'),value: '数学'),
                  DropdownMenuItem(child: Text('英语'),value: '英语'),
                ],
                onChanged: (value){
                  setState(() {
                    _dropValue = value;
                  });
                },
              ),
              FloatingActionButton(onPressed: _ontap),
              IconButton(onPressed: _ontap, icon: Icon(Icons.details,color: Colors.blue,)),
              MaterialButton(onPressed: _ontap,child: Text('MaterialButton'),),
              OutlinedButton(onPressed: _ontap, child: Text('OutlinedButton')),
              OutlinedButton.icon(onPressed: _ontap, icon: Icon(Icons.ac_unit), label: Text('OutlinedButton.icon')),
              PopupMenuButton(itemBuilder: (BuildContext context)=> //菜单项构造器
              <PopupMenuEntry<ConferenceItem>>[
                const PopupMenuItem<ConferenceItem>(
                  //菜单项
                  value: ConferenceItem.AddMember,
                  child: Text('添加成员'),
                ),
                const PopupMenuItem<ConferenceItem>(
                  value: ConferenceItem.LockConference,
                  child: Text('锁定会议'),
                ),
                const PopupMenuItem<ConferenceItem>(
                  value: ConferenceItem.ModifyLayout,
                  child: Text('修改布局'),
                ),
                const PopupMenuItem<ConferenceItem>(
                  value: ConferenceItem.TurnoffAl,
                  child: Text('挂断所有'),
                ),
              ],),
              RawMaterialButton(onPressed: _ontap,child: Text('RawMaterialButton'),),
              TextSelectionToolbarTextButton(child: Text('TextSelectionToolbarTextButton'), padding: EdgeInsets.all(30)),
              BackButtonIcon(),
            ],
        ),
      ),
    );
  }

  _ontap(){
    print('点击button');
  }
  _buildButton(Widget child){
    return Container(child: child,
      color: Colors.white70,
      width: 100,
    );
  }
}
